﻿<UserControl x:Class="DetiInteract.Guide.Controls.Viewer3DView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:c="clr-namespace:DetiInteract.Guide.Controls.ContentControls.Viewer3DControl"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
		<ListBox x:Name="_Models"
				 ItemsSource="{Binding ModelList}"
				 Margin="25,0"
				 BorderBrush="Transparent"
				 Background="WhiteSmoke"
				 Width="{Binding Width, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}" 
				 Height="{Binding Width, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}" 
				 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
				 ScrollViewer.VerticalScrollBarVisibility="Hidden"
				 PreviewMouseDown="ListBox_MouseDown"
				 MouseUp="ListBox_MouseUp"
				 MouseMove="ListBox_MouseMove"
				 MouseDoubleClick="_Models_MouseDoubleClick">
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<!--Try virtualizing wrappanel here-->
					<WrapPanel Orientation="Horizontal" 
							   ItemHeight="170" 
							   ItemWidth="290"/>
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
			<ListBox.ItemContainerStyle>
				<!-- Customize listbox style -->
				<Style TargetType="ListBoxItem">
					<!-- Set selection highlight color to Cornflower blue -->
					<Style.Resources>
						<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" 
										 Color="CornflowerBlue"/>
					</Style.Resources>
				</Style>
			</ListBox.ItemContainerStyle>
		</ListBox>
		<c:Viewer3DPanel x:Name="_Viewer"
						 Game="{Binding Game}" 
						 Margin="50"
						 MouseDown="Viewer3DPanel_MouseDown" 
						 MouseUp="Viewer3DPanel_MouseUp"
						 MouseMove="Viewer3DPanel_MouseMove" 
						 Background="WhiteSmoke"
						 Width="{Binding Width, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}" 
						 Height="{Binding Width, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}" 
						 Visibility="Hidden"/>
	</Grid>
</UserControl>
